package com.swu.pad.event.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.swu.pad.event.dao.EventDao;
import com.swu.pad.event.dao.RftWritingEventDao;
import com.swu.pad.event.entity.Event;
import com.swu.pad.event.entity.RftWritingEvent;
import com.swu.pad.event.service.EventService;
import com.swu.pad.system.dao.UserDao;
import com.swu.pad.util.TimeUtil;

@Service
@Transactional
public class EventServiceImpl implements EventService {
    
	@Autowired
	private  UserDao userDao;

	@Autowired
	private EventDao eventDao;
	@Autowired
	private RftWritingEventDao rftWritingEventDao;
	
    
	@Override
	public Event getEventById(String eventId) {
		return eventDao.findOne(eventId);
	}

	@Override
	public List<Event> getUserEvents(String userId) {
		// TODO Auto-generated method stub
		return null;
	}
    
	/**
	 * 存储事件
	 */
	@Override
	public void saveUserEvent(Event event) {
		
		eventDao.saveAndFlush(event);
	}
    
	//保存学生  反思写作中的行为
	@Override
	public void saveRftWritingEvent(RftWritingEvent rftWritingEvent) {
		rftWritingEvent.setActionTime(TimeUtil.getStringDate());
		rftWritingEventDao.saveAndFlush(rftWritingEvent);
	}

}
